<template>
    <div class="choose-address">
        <div class="address-list">
            <div class="address-item" v-for="item in addressList" :key="item.id">
                {{ item.name }}
            </div>
        </div>
    </div>
</template>


<script>
import addressAPI from '@/api/address';
export default {
    data(){
        return{
            addressList: [],
        }
    },
    created(){
        this.getAddressList(1)
    },
    methods:{
        getAddressList(current){
            let data = {
                current
            }
            addressAPI.getAddress(data)
            .then(res => {
                if(res.code == 200){
                    this.$toast(res.message)
                    this.addressList = res.data.addressList.records
                }else this.$toast(res.message)
            })
        },
    }
}
</script>